home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!genesis.demon.co.uk
- From: Lawrence Kirby <fred@genesis.demon.co.uk>
- Newsgroups: comp.lang.c
- Subject: Re: What's so different about 2-D arrays???
- Date: Tue, 02 Jan 96 20:53:36 GMT
- Organization: none
- Message-ID: <820616016snz@genesis.demon.co.uk>
- References: <820451938.20697@fredblog.demon.co.uk> <4c799b$q9d@umbc9.umbc.edu> <4ca3j0$fsj@zippy.cais.net>
- Reply-To: fred@genesis.demon.co.uk
- X-NNTP-Posting-Host: genesis.demon.co.uk
- X-Newsreader: Demon Internet Simple News v1.27
- X-Mail2News-Path: genesis.demon.co.uk
-
- In article <4ca3j0$fsj@zippy.cais.net>
- mgeiger@drsystems.com "Mark Geiger" writes:
-
- >schlein@umbc.edu (Jonas J. Schlein) wrote:
- >
- >[snip]
- >
- >>|>
- >>|> //My own chess recorder program
- >
- >>Illegal comment! This is comp.lang.c not comp.lang.c++.
- >
- >Give me a break.
-
- Give the people to are trying to help a break. Once of the basic procedures
- in analysing somebody's code is compiling it. It is basic courtesy to post
- valid C code what will compile on a C compiler. In C //M is a syntax error.
- Presumably the original poster didn't know this so it is helpful to point
- it out.
-
-
- >>|> #include <stdio.h>
- >>|> #include <ctype.h>
- >
- >>Why do you need <ctype.h>?
- >
- >What difference does it make?
-
- It may suggest a misunderstanding on the part of the original poster, or
- imply the existence of something not shown in the original post. It is
- best to post minimal code, extraneous code just serves to confuse.
-
- >>|> /*Prototypes*/
- >>|> void setup(char pos[8][8]);
- >>|>
- >>|> void main()
- >
- >>Please read the FAQ. This will show you why 'int main (void)' is the correct
- >>declaration for your particular program.
- >
- >Couldn't you have put this a bit more constructively?
-
- I don't see how. Reading the FAQ is probably the best thing the original
- poster could possibly do. The FAQ exists so that its contents don't need
- to be repeated in the newsgroup.
-
- >>|> {
- >>|> char pos[8][8];
- >>|>
- >>|> setup(pos);
- >>|>
- >>|>
- >>|> printf("\nWell Done!!");
- >
- >>A simple 'return (0);' would go here nicely.
- >
- >Not the way it was coded...main is a void function.
-
- No, in C main is a function that returns int. Once the illegal void main()
- line is fixed the return (0); is a natural addition.
-
- > Yes, I know that
- >he should return an explicit value and not some random garbage, but
- >sarcasm is seldom helpful.
-
- There was no sarcasm here, just a simple improvement to the program. As you
- imply it isn't necessary for a program to be strictly correct but it is
- very desirable.
-
- >>|> }
- >>|>
- >>|> void setup(char pos[8][8])
- >
- >>What exactly do you think an array is and how do you believe it is
- >>supposed to be indexed? In C arrays start at 0 so an array with
- >>8 elements is indexed from 0-7 not 1-8. This is true for each and
- >>every dimension of a multi-dimensional array.
- >
- >IMHO, this is the only valuable paragraph in your post, but we could
- >have done without the first sentence.
-
- Possibly. In my experience it is often easy to read a post in a worse light
- than intended. I don't know what Jonas intended but taken at face value
- it is a useful question to ask yourself (a general rather than specific
- 'you').
-
- >My point in responding in this manner is that people should be able to
- >ask questions in this forum without being subjected to ridicule and
- >petty criticism.
-
- It is also important to recognise the help that is being given.
-
- --
- -----------------------------------------
- Lawrence Kirby | fred@genesis.demon.co.uk
- Wilts, England | 70734.126@compuserve.com
- -----------------------------------------
-